#ifndef __COUNT_DOWN_LATCH_H__
#define __COUNT_DOWN_LATCH_H__

#include "OSType.h"
#include "Mutex.h"
#include "Condition.h"

class CCountDownLatch : public CNonCopyable
{
public:
	CCountDownLatch(Int32 nCount);

	void Wait();
	void CountDown();
	Int32 GetCount() const;

	static void CountDown_(void *arg);

private:
	mutable CMutex		m_mutex;
	CCondition			m_cond;
	Int32				m_nCount;
};


#endif
